namespace NAct.Patterns
{
	using System.Text.RegularExpressions;

	public class PatternMatcher: IPatternMatcher
	{
		private readonly Regex matcher;

		public PatternMatcher( string pattern )
		{
			matcher = new Regex( pattern, RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase );
		}

		public IPatternParseResults Parse( string source )
		{
			return new PatternParseResults( matcher.Matches( source ), matcher.GetGroupNames() );
		}
	}
}